﻿<script>
    function unlinkProvider(providerId, id) {
        if (confirm('Are you sure you want to unlink this organization from its provider?')) {
            $.ajax({
                type: "POST",
                url: `@Url.Action("Delete", "ProviderOrganizations")?providerId=${providerId}&id=${id}`,
                dataType: 'json',
                contentType: false,
                processData: false,
                success: function (response) {
                    alert("Successfully unlinked provider");
                    window.location.href = `@Url.Action("Edit", "Providers")?id=${providerId}`;
                },
                error: function (response) {
                    alert("Error!");
                }
            });
        }
        return false;
    }
</script>
